import request from "../request";
import type { Ref } from "vue";

interface CouponListParams {
	pageNum?: number;
	pageSize?: number;
	name?: string | Ref<string>;
	type?: number;
}
interface CouponListItem {
	id: number;
	type: number;
	name: string | null;
	platform: number;
	count: number;
	amount: number;
	perLimit: number;
	minPoint: number;
	startTime: string | null;
	endTime: string | null;
	useType: number;
	note: string | null;
	publishCount: number;
	useCount: number;
	receiveCount: number;
	enableTime: string | null;
	code?: string | null;
	memberLevel?: string | null;
}
interface CouponListRes {
	list: Array<CouponListItem>;
	pageNum: number;
	pageSize: number;
	total: number;
	totalPage: number;
}
const CouponListAPI = (data?: CouponListParams): Promise<CouponListRes> => request.get("/coupon/list", { params: data });

export { CouponListAPI };
